﻿using UnityEngine;
using System.Collections;
using Holoville.HOTween;
namespace MainGameplay
{

    public class ButtonSript : MonoBehaviour
    {
        public GameObject target;
        public string functionName;
        public string functionParam;

        // Use this for initialization
        void Start()
        {
            
        }

        // Update is called once per frame
        void Update()
        {

        }

        void OnMouseDown()
        {
                //var audio = GetComponent<AudioSource>();
                //audio.enabled = true;
                //audio.Play();

            if (target != null)
            {
                HOTween.To(transform, 0.2f, new TweenParms()
                    .Prop("localScale", new Vector3(0.8f, 0.8f))
                    .OnComplete(target, functionName, functionParam, SendMessageOptions.DontRequireReceiver));
            }

            else
            {
                target = GameObject.Find("GameManager");
            }
                HOTween.To(transform, 0.2f, new TweenParms()
                    .Prop("localScale", new Vector3(1f, 1f, 1f))
                    .Delay(0.2f));
        }
    }
}
